<?php defined('SYSPATH') or die('No direct script access.');

class Model_Forum_Message extends ORM {
	
	protected $_table_name = 'forum_message';
	
	protected $_primary_key = 'id';
	
	protected $_belongs_to = array(
		'user' => array(
			'model' => 'user',
			'foreign_key' => 'user_id',
		),
		'section' => array(
			'model' => 'Forum_Section',
			'foreign_key' => 'section_id',
		),
		'cat' => array(
			'model' => 'Forum_Cat',
			'foreign_key' => 'cat_id',
		),
		'topic' => array(
			'model' => 'Forum_Topic',
			'foreign_key' => 'topic_id',
		),
	);
	
	protected $_pc_table_columns = array(
		'id' => array(
			'type' => 'INT(11)',
			'AUTO_INCREMENT' => TRUE,
		),
		'user_id' => array(
			'type' => 'INT(11)',
		),
		'section_id' => array(
			'type' => 'INT(11)',
		),
		'cat_id' => array(
			'type' => 'INT(11)',
		),
		'topic_id' => array(
			'type' => 'INT(11)',
		),
		'text' => array(
			'type' => 'TEXT',
		),
		'date' => array(
			'type' => 'INT(11)',
		),
		'deleted' => array(
			'type' => 'INT(1)',
		),
		'ip' => array(
			'type' => 'VARCHAR(15)',
		),
	);
	
	protected $_pc_table_indexes = array(
		'id' => array(
			'PRIMARY_KEY' => array(),
		),
		'user_id' => array(
			'INDEX' => array('name' => 'user_id'),
		),
		'section_id' => array(
			'INDEX' => array('name' => 'section_id'),
		),
		'cat_id' => array(
			'INDEX' => array('name' => 'cat_id'),
		),
		'topic_id' => array(
			'INDEX' => array('name' => 'topic_id'),
		),
		'date' => array(
			'INDEX' => array('name' => 'date'),
		),
		'deleted' => array(
			'INDEX' => array('name' => 'deleted'),
		),
		'ip' => array(
			'INDEX' => array('name' => 'ip'),
		),
	);
	
}